<?php
/**
 * Created by Allen.
 * Date: 15-12-03
 * 节点模型
 */

class Fora_model extends HS_Model {

	//添加
    public function addFora($data)
    {
        if ($this->add($data))
        {
            return $this->db->insert_id();
        }
    }
    
    //获取单个
    public function checkFora($where=array())
    {
    	return $this->where($where)->find();
    }

    //编辑
    public function editFora($where,$data)
    {
        return $this->where($where)->edit($data);
    }
    
    //获取结果集
    public function getForaList($where=array(), $limit='20', $offset='0', $order_by='name asc')
    {
    	return $this->where($where)->limit($limit, $offset)->order_by($order_by)->find_all();
    }
    
    //获取全部结果集，用于表格导出
    public function getForaAll($where=array(), $order_by='name asc')
    {
    	return $this->where($where)->order_by($order_by)->find_all();
    }
    
    //计算行数
    public function getCount($where = array())
    {
    	return $this->where($where)->count();
    }
    
    //删除
    public function deleteFora($where)
    {
    	return $this->where($where)->delete();
    }
} 